// src/common/dto/pagination.dto.ts
import { ApiQuery } from '@nestjs/swagger';

@ApiQuery({ name: 'page', required: false, description: '页码' })
@ApiQuery({ name: 'limit', required: false, description: '每页显示条数' })
export class PaginationDto {
  page: number;
  limit: number;
  skip: number;

  constructor(page: number, limit: number) {
    this.page = page > 0 ? page : 1;
    this.limit = limit > 0 ? limit : 10;
    this.skip = (this.page - 1) * this.limit;
  }
}
